return 0;
}
-static int tpmfront_suspend(struct xenbus_device *dev)
+static int
+tpmfront_suspend(struct xenbus_device *dev)
{
struct tpmfront_info *info = dev->data;
struct tpm_private *tp = &my_private;
+ u32 ctr = 0;
- /* lock so no app can send */
+ /* lock, so no app can send */
down(&suspend_lock);
- while (atomic_read(&tp->tx_busy)) {
- printk("---- TPMIF: Outstanding request.\n");
-#if 0
+ while (atomic_read(&tp->tx_busy) && ctr <= 25) {
+ if ((ctr % 10) == 0)
+ printk("INFO: Waiting for outstanding request.\n");
/*
- * Would like to wait until the outstanding request
- * has come back, but this does not work properly, yet.
+ * Wait for a request to be responded to.
*/
- interruptible_sleep_on_timeout(&tp->wait_q,
- 100);
-#else
- break;
-#endif
+ interruptible_sleep_on_timeout(&tp->wait_q, 100);
+ ctr++;
+ }
+
+ if (atomic_read(&tp->tx_busy)) {
+ /*
+ * A temporary work-around.
+ */
+ printk("WARNING: Resetting busy flag.");
+ atomic_set(&tp->tx_busy, 0);
}
unregister_xenbus_watch(&info->watch);
kfree(info->backend);
info->backend = NULL;
- destroy_tpmring(info, tp);
-
- return 0;
-}
-
-static int tpmif_recover(void)
-{
return 0;
}
-static int tpmfront_resume(struct xenbus_device *dev)
+static int
+tpmfront_resume(struct xenbus_device *dev)
{
struct tpmfront_info *info = dev->data;
- int err;
+ int err = talk_to_backend(dev, info);
- err = talk_to_backend(dev, info);
- if (!err) {
- tpmif_recover();
- }
-
- /* unlock so apps can resume */
+ /* unlock, so apps can resume sending */
up(&suspend_lock);
return err;
}
-static void tpmif_connect(u16 evtchn, domid_t domid)
+static void
+tpmif_connect(u16 evtchn, domid_t domid)
{
int err = 0;
struct tpm_private *tp = &my_private;
tp->evtchn = evtchn;
- tp->backend_id = domid;
+ tp->backend_id = domid;
- err = bind_evtchn_to_irqhandler(
- tp->evtchn,
- tpmif_int, SA_SAMPLE_RANDOM, "tpmif", tp);
- if ( err <= 0 ) {
+ err = bind_evtchn_to_irqhandler(tp->evtchn,
+ tpmif_int, SA_SAMPLE_RANDOM, "tpmif",
+ tp);
+ if (err <= 0) {
WPRINTK("bind_evtchn_to_irqhandler failed (err=%d)\n", err);
return;
}
if (NULL == txb) {
DPRINTK("txb (i=%d) is NULL. buffers initilized?\n", i);
- DPRINTK("Not transmittin anything!\n");
+ DPRINTK("Not transmitting anything!\n");
spin_unlock_irq(&tp->tx_lock);
return -EFAULT;
}
"""@see DevController.getDeviceDetails"""
devid = int(sxp.child_value(config, 'instance', '0'))
- log.debug("The domain has a TPM with instance %d." % devid)
+ log.info("The domain has a TPM with instance %d." % devid)
back = { 'instance' : "%i" % devid }
front = { 'handle' : "%i" % devid }
return (devid, back, front)
+
+ def configuration(self, devid):
+
+ log.info("The configuration method is called.")
+
+ result = DevContoller.configuration(self, devid)
+
+ (instance) = self.readBackend(devif,
+ 'instance')
+
+ if instance:
+ result.append(['instance', instance])
+ log.info("configuration: instance=%d." % instance)
+
+ return result